Home > Java Programming > Language Fundamentals > Questions and Answers
01. |
What will happen if you try to compile and run this ? public class Test{ static{ print(10); } static void print(int x){ System.out.println(x); System.exit(0); } } | |||||||||||||||
|
02. |
Is this legal? long longArr[]; int intArr[] = { 7 ,8 , 9}; longArr = intArr; | |||||||||||
|
03. |
True or False. The range of a byte is from -127 to 128 | |||||||||||
|
04. |
Identify the valid assignments. 1. float f = \u0038; 2. long L2 = 2L; 3. float f = 1.2; 4. char c = '/u004E'; 5. byte b = 100; | |||||||||||
|
05. |
What is the result of trying to compile and run the following code. public static void main(String[] args){ double d = 10 / 0; if(d == Double.POSITIVE_INFINITY) System.out.println("Positive infinity"); else System.out.println("Negative infinity"); } | |||||||||||
|
06. | What is the correct ordering for the import, class and package declarations when found in a single file? | |||||||||||
|